import React, { PureComponent } from 'react'
import { View, Text, StyleSheet } from 'react-native'
import * as _ from 'lodash'
import { List } from 'antd-mobile'
import {connect} from 'react-redux'
import screen from '../../utils/screen'
import { createAction, NavigationActions } from '../../utils'

const Item = List.Item

@connect(({ consultant, loading }) => ({ ...consultant, isLoading: loading.models.consultant }))
export default class extends PureComponent {
  constructor(props) {
    super(props)
  }
  componentDidMount() {
    this.props.dispatch(createAction("consultant/getSecondList")({}))
  }
  render() {
    const { secondList } = this.props;
    return (
      <View>
        <List>
          {
            _.map(secondList, (v, i) => {
              return (
                <Item key={i} arrow="horizontal" onClick={() => {
                  this.props.navigation.navigate('ConsultantStack', {
                    codeName: v.name,
                    type: 2,
                    projectId: v.id
                  })
                }}><Text style={styles.innerText}>{v.name}</Text></Item>
              )
            })
          }
        </List>
      </View>
    )
  }
}

const styles = StyleSheet.create({
  innerText: {
    color: '#636363',
    fontSize: screen.pxToDp(32)
  }
})
